package cn.dada.dadarecipes.community.thumbsup.controller;

import cn.dada.dadarecipes.base.response.JsonResult;
import cn.dada.dadarecipes.community.thumbsup.pojo.dto.ThumbsUpSaveParam;
import cn.dada.dadarecipes.community.thumbsup.service.ThumbsUpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpSession;
import javax.validation.Valid;

@Slf4j
@Api(tags = "02.05点赞管理")
@RestController
@RequestMapping("/v1/article/thumbsUp/")
public class ThumbsUpController {
    @Autowired
    private ThumbsUpService thumbsUpService;



    /**
     * 控制器-文章点赞
     * @param thumbsUpSaveParam
     * @return
     */
    @PostMapping("save")
    @ApiOperation("文章点赞控制")
    public JsonResult saveArticleThumbsUp(@Validated ThumbsUpSaveParam thumbsUpSaveParam, @ApiIgnore HttpSession session) {
        log.debug("控制器-文章点赞: {},{}", thumbsUpSaveParam,session);
        thumbsUpService.saveArticleThumbsUp(thumbsUpSaveParam,session);
        return JsonResult.ok();
    }

}
